class AddStatusId < ActiveRecord::Migration
  def self.up
    # productos
    add_column :productos, :status_id, :integer, :default => 0
    execute 'update productos set status_id = 1'
    
    # empleados
    add_column :empleados, :status_id, :integer, :default => 0
    execute 'update empleados set status_id = 1'
    
    # evaluaciones
    add_column :evaluaciones, :status_id, :integer, :default => 0
    execute 'update evaluaciones set status_id = 1'
    
    # facturas
    add_column :facturas, :status_id, :integer, :default => 0
    execute 'update facturas set status_id = 1'
    
    # mayoristas
    add_column :mayoristas, :status_id, :integer, :default => 0
    execute 'update mayoristas set status_id = 1'
    
    # orden_salidas
    add_column :orden_salidas, :status_id, :integer, :default => 0
    execute 'update orden_salidas set status_id = 1'
    
    # salida_materiales
    add_column :salida_materiales, :status_id, :integer, :default => 0
    execute 'update salida_materiales set status_id = 1'
        
  end

  def self.down
    # productos
    remove_column :productos, :status_id
    
    # empleados
    remove_column :empleados, :status_id
    
    # evaluaciones
    remove_column :evaluaciones, :status_id
    
    # facturas
    remove_column :facturas, :status_id
    
    # mayoristas
    remove_column :mayoristas, :status_id
    
    # orden_salidas
    remove_column :orden_salidas, :status_id
    
    # salida_materiales
    remove_column :salida_materiales, :status_id
  end
end
